
import request from '@/utils/request';
import { Result } from './definitions/Result';
import { News } from './definitions/News';
import { ResultPageNews } from './definitions/ResultPageNews';
import { NewsParam } from './definitions/NewsParam';


export class NewsAdminController {

    static addUsingPOSTPath: string = "/v1/admin/news";
    /// 新增咨询
    async addUsingPOST(data: News, headers?: any):  Promise<any> {
      return request(`/v1/admin/news`, {
        method: "POST",
        data: JSON.stringify(data) ,
        headers: headers,
      }) as Promise<any>;
    }
    
    static updateUsingPUTPath: string = "/v1/admin/news";
    /// 编辑咨询
    async updateUsingPUT(data: News, headers?: any):  Promise<any> {
      return request(`/v1/admin/news`, {
        method: "PUT",
        data: JSON.stringify(data) ,
        headers: headers,
      }) as Promise<any>;
    }
    
    static cancelTopUsingPOSTPath: string = "/v1/admin/news/cancelTop/{id}";
    /// 取消置顶
    async cancelTopUsingPOST(id: string,  headers?: any):  Promise<any> {
      return request(`/v1/admin/news/cancelTop/${id}`, {
        method: "POST",
        data: null ,
        headers: headers,
      }) as Promise<any>;
    }
    
    static pageUsingPOSTPath: string = "/v1/admin/news/page";
    /// 咨询列表
    async pageUsingPOST(data: NewsParam, headers?: any):  Promise<ResultPageNews> {
      return request(`/v1/admin/news/page`, {
        method: "POST",
        data: JSON.stringify(data) ,
        headers: headers,
      }) as Promise<any>;
    }
    
    static topUsingPOSTPath: string = "/v1/admin/news/top/{id}";
    /// 置顶
    async topUsingPOST(id: string,  headers?: any):  Promise<any> {
      return request(`/v1/admin/news/top/${id}`, {
        method: "POST",
        data: null ,
        headers: headers,
      }) as Promise<any>;
    }
    
    static getUsingGETPath: string = "/v1/admin/news/{id}";

    async getUsingGET(id: string,  headers?: any) : Promise<any> {
      return request(`/v1/admin/news/${id}`, {
        method: "GET",
        headers: headers,
      }) as Promise<any>;
    }
    
    static deleteUsingDELETEPath: string = "/v1/admin/news/{id}";

    async deleteUsingDELETE(id: string,  headers?: any) : Promise<any> {
      return request(`/v1/admin/news/${id}`, {
        method: "DELETE",
        headers: headers,
      }) as Promise<any>;
    }
    
}